import sys
import fileinput

import argparse


parser = argparse.ArgumentParser()
parser.add_argument("textToReplace", help="text To Replace")
args = parser.parse_args()

textToReplace=args.textToReplace

out=textToReplace+".proto"

textToSearch="nnnnnnnnn"

with open(out, 'w') as f:
    print(
        '''

syntax = "proto3";
package nnnnnnnnn_pack;
// import "google/rpc/status.proto";
message nnnnnnnnn{
  string nnnnnnnnn_key = 1;
  string nnnnnnnnn_value = 2;
}
message nnnnnnnnnSetRequest {
  nnnnnnnnn nnnnnnnnn_request=1;
}

message nnnnnnnnnSetReply {
  string nnnnnnnnn_key = 1;
  bool flag = 2;
}

message nnnnnnnnnGetRequest {
  string nnnnnnnnn_key = 1;
}
message nnnnnnnnnGetReply {
  nnnnnnnnn nnnnnnnnn_reply=1;
  bool flag = 2;
}


service grpc_service_nnnnnnnnn {
  rpc setnnnnnnnnn (nnnnnnnnnSetRequest) returns (nnnnnnnnnSetReply);  
  rpc getnnnnnnnnn (nnnnnnnnnGetRequest) returns (nnnnnnnnnGetReply);  
}

message Empty {

}


''', file=f)
with fileinput.FileInput(out, inplace=True) as file:
    for line in file:
        print(line.replace(textToSearch, textToReplace), end='')